IMG SlideShow


Exercise 1

Create a simple image slideshow that automatically cycles through a set of images using setInterval.
On html create a div and inside div put 3 images
so at the time show only on image after 3 second show 2nd image and after 3 second show third image so keep rotation each 3 seconds.

   
  const slides = document.querySelectorAll('.img');
    let current = 0;

    setInterval(() => {
      slides[current].classList.remove('active');
      current = (current + 1) % slides.length;
      slides[current].classList.add('active');
    }, 3000);